﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="usersubmenugrid.aspx.cs" Inherits="LTJ.WebPage.SystemManage.system.usersubmenugrid" %>
<%@ Register TagPrefix="dyj" Namespace="LTJ.Control" Assembly="LTJ.Control" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>系统管理子菜单列表</title>
    <link href="../css/comm.css" type="text/css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="../js/modalpopup.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="adnr">
		<ul class="adnr2 mar_top">
			<li><a href="#" onclick="newMenu();">新 增</a></li>
            <li><a href="usermainmenugrid.aspx?menuid=<%=menuid%>">返 回</a></li>
		</ul>
		<div class="adnr3">
           <dyj:datagrid id="DataGrid1" runat="server">
	       <Columns>
            <asp:BoundColumn DataField="id" HeaderText="序号" readonly="true"></asp:BoundColumn>
	        <asp:BoundColumn DataField="title" HeaderText="主菜单名称"></asp:BoundColumn>
            <asp:BoundColumn DataField="etitle" HeaderText="英文名称" readonly="true"></asp:BoundColumn>
            <asp:BoundColumn DataField="defaulturl" HeaderText="页面地址" readonly="true"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="操作实体">
                <ItemTemplate>
                <%#LTJ.Entity.EnumType.GetOpModeName(LTJ.Common.Utils.StrToInt(DataBinder.Eval(Container, "DataItem.frameid").ToString(),0))%>
                </ItemTemplate>
            </asp:TemplateColumn>
              <asp:TemplateColumn HeaderText="操作">
                <ItemTemplate>
                   <a href="javascript:;" class="l_blue" onclick="editMenu('<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>','<%# DataBinder.Eval(Container, "DataItem.title").ToString() %>','<%# DataBinder.Eval(Container, "DataItem.defaulturl").ToString() %>','<%# DataBinder.Eval(Container, "DataItem.etitle").ToString() %>','<%# DataBinder.Eval(Container, "DataItem.frameid").ToString() %>');">编辑</a>&nbsp;
                   <a class="l_blue" href="usersubmenugrid.aspx?menuid=<%=menuid%>&submenuid=<%=submenuid%>&pagename=<%=pagename%>&mode=del&id=<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>" onclick='return confirm("您确认要删除此菜单项吗？")'>删除</a>
                </ItemTemplate>
              </asp:TemplateColumn>
          </Columns>
	    </dyj:datagrid>
		</div>
		<i class="tp"></i><i class="bt"></i>
	</div>
   <div id="BOX_overlay" style="background: #000; position: absolute; z-index: 100; filter: alpha(opacity=50); -moz-opacity: 0.6; opacity: 0.6;">
    </div>
    <div id="neworeditsubmenuitem" style="display: none; background: #fff; padding: 10px; border: 1px solid #999; width: 400px;">
        <div class="ManagerForm">
            <fieldset>
                <legend id="opt" style="background: url(../images/icons/icon53.jpg) no-repeat 6px 50%;">
                    新建子菜单</legend>
                <table cellspacing="0" cellpadding="4" class="adtb" width="80%">
                    <tr>
                        <td width="25%"><p class="zi1">菜单名称:</p>
                            <input type="hidden" id="id" name="id" value="0" />
                        </td>
                        <td>
                            <p class="zi2"><input id="menutitle" name="menutitle" type="text" maxlength="8" size="10" class="soout" onfocus="this.className='soon';" onblur="this.className='soout';" /></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="zi1">页面地址:</p>
                        </td>
                        <td>
                            <p class="zi2"><input id="defaulturl" name="defaulturl" type="text" maxlength="100" size="30" class="soout" onfocus="this.className='soon';" onblur="this.className='soout';" /></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="zi1">英文名称:</p>
                        </td>
                        <td>
                            <p class="zi2"><input id="etitle" name="etitle" type="text" maxlength="100" size="30" class="soout" onfocus="this.className='soon';" onblur="this.className='soout';" /></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="zi1">操作实体:</p>
                        </td>
                        <td>
                            <p class="zi2">
                            <select id="opmode" name="opmode">
                            <option value="0" selected="selected">请选择操作实体</option>
                            <%
                                LTJ.Entity.OPMode opmodes = new LTJ.Entity.OPMode();
                                foreach (string cname in Enum.GetNames(opmodes.GetType()))
                                {
                                    int s_value = Convert.ToInt16(Enum.Parse(opmodes.GetType(), cname));
                            %>
                            <option value="<%=s_value%>"><%=LTJ.Entity.EnumType.GetOpModeName(s_value)%></option>
                            <%
                                }        
                            %>
                            </select>
                            </p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                        <input type="submit" value="提 交" class="save" onclick="chkSubmit();"/>
                            &nbsp;&nbsp;
                        <input type="button" value="取 消" class="save" onclick="BOX_remove('neworeditsubmenuitem');" />
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
    </div>
    <div id="setting" />
    </form>
</body>
<script type="text/javascript">
    function newMenu() {
        document.getElementById("opt").innerHTML = "新建主菜单";
        document.getElementById("id").value = "-1";
        document.getElementById("menutitle").value = "";
        document.getElementById("defaulturl").value = "";
        document.getElementById("etitle").value = "";
        document.getElementById("opmode").value = 0;
        BOX_show('neworeditsubmenuitem');
    }
    function editMenu(menuid, menutitle, defaulturl, etitle, opvalue) {
        document.getElementById("opt").innerHTML = "编辑主菜单";
        document.getElementById("id").value = menuid;
        document.getElementById("menutitle").value = menutitle;
        document.getElementById("defaulturl").value = defaulturl;
        document.getElementById("etitle").value = etitle;
        document.getElementById("opmode").value = opvalue;
        BOX_show('neworeditsubmenuitem');
    }
    function chkSubmit() {
        if (document.getElementById("menutitle").value == "") {
            alert("主菜单名称不能为空！");
            document.getElementById("menutitle").focus();
            return false;
        }
        if (document.getElementById("defaulturl").value == "") {
            if (!confirm("您确认要将默认展现页面地址置空吗？")) {
                document.getElementById("defaulturl").focus();
                return false;
            }
        }
        if (document.getElementById("etitle").value == "") {
            if (!confirm("主菜单英文名称不能为空！")) {
                document.getElementById("etitle").focus();
                return false;
            }
        }
        //document.getElementById("<%=Form.ClientID%>").submit();
        return true;
    }
</script>
</html>
